<?php
/*
 * 防止sql注入
 */
class SlashesValidator {
	/*
	 * addslashes
	 */
	public function new_addslashes($string){
		if(!is_array($string))	return addslashes($string);
		
		foreach($string as $key => $val) $string[$key] = $this->new_addslashes($val);
		
		return $string;
	}
	
	/*
	 * stripslashes
	 */
	public function new_stripslashes($string){
		if(!is_array($string)) return stripslashes($string);
		
		foreach($string as $key => $val) $string[$key] = $this->new_stripslashes($val);
		
		return $string;
	}
}